In [3]:
import plotly
plotly.offline.init_notebook_mode()
import cufflinks as cf
cf.go_offline()
cf.set_config_file(theme='ggplot')
from plotly.graph_objs import Bar,Layout, Figure,Data,Scattermapbox,Marker,Surface,XAxis,YAxis,ZAxis,Scene,Scatter
In [2]:
import pandas as pd
import numpy as np

Line plot

In [10]:
N = 500
x = np.linspace(0, 1, N)
y = np.random.randn(N)
df = pd.DataFrame({'x': x, 'y': y})
In [11]:
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 500 entries, 0 to 499
Data columns (total 2 columns):
x    500 non-null float64
y    500 non-null float64
dtypes: float64(2)
memory usage: 7.9 KB
In [15]:
df.set_index('x',inplace=True)
In [12]:
#df = cf.datagen.lines(4)
In [22]:
fig=df.iplot(kind='scatter',mode='lines',asFigure=True)
In [34]:
layout=Layout(title='XvsYplot',
              xaxis={'title':'X'},
              yaxis={'title':'Y'})
In [36]:
fig.update(layout=layout)
In [38]:
plotly.offline.iplot(fig)